{extend name="$index_style_layout" /}
{block name="head_title"}{$info.title}{/block}

{block name="body_Class"}release_page{/block}
{block name="body_ExtraHead"}
<script src="__STATIC__/qy_dd/web/js/num.js?v=v11" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
	.logo{
		width: 80px;
	}
	.bocweb-header .logo{
		margin-top: 10px;
	}
</style>
{/block}

{block name="body_content"}
<div class="main release">

<div class="box f-cb">
	<div class="box_l" style="background:url(__STATIC__/qy_dd/web/img/login_bg.jpg?v=v11) no-repeat center center;background-size:cover;">
		<div class="text_box">
			<div class="text">{qb:tag name="login_title" type="text"}欢迎您登录 {$webdb.webname}{/qb:tag}</div>
			<div class="choose">
				{qb:tag name="login_choose_third" type="text"}
				<a href="{:purl('login/qq/index')}">
					<div class="icon">
						<img src="__STATIC__/qy_dd/web/img/qq1.png?v=v11" alt="">
						<img src="__STATIC__/qy_dd/web/img/qq2.png?v=v11" alt="" class="active">
					</div>
					<span>QQ登录</span>
				</a>
				<a class="active website-login weixinsacn">
					<div class="icon">
						<img src="__STATIC__/qy_dd/web/img/wx1.png?v=v11" alt="">
						<img src="__STATIC__/qy_dd/web/img/wx2.png?v=v11" alt="" class="active">
					</div>
					<i class="weixin"></i>
					<span>微信登录</span>
				</a>
				{/qb:tag}
			</div>
			<div class="copyright">
				{qb:tag name="login_copyright" type="textarea"}
				<div class="copyright">
					<p>{$webdb.copyright}</p>
				</div>
				{/qb:tag}
			</div>
		</div>
	</div>
	<div class="login_box w1280 f-cb">
		<div class="login">
			<div class="login_tit">
				<div class="t">个人登录</div>
				<div class="choose">
					<a href="javascript:;" class="active">密码登录</a>
					<a href="javascript:;">验证码登录</a>
				</div>
			</div>
			<div class="fb">
				<div class="form show">
					<form id="form2" action="{:urls('login/index')}"  method="post">
						<div class="input_box">
							<input type="text" name="username" id="username" placeholder="请输入用户名">
							<div class="icon">
								<img src="__STATIC__/qy_dd/web/img/sj.png?v=v11" alt="">
							</div>
						</div>
						<div class="input_box">
							<input type="password" name="password" id="password" placeholder="请输入密码（6-20位字符）">
							<div class="icon">
								<img src="__STATIC__/qy_dd/web/img/password.png?v=v11" alt="">
							</div>
						</div>
						<div class="forget">
							<a href="{:urls('getpassword/index')}">忘记密码？</a>
						</div>
						<div class="bot f-cb">
							<input type="submit" value="登录" class="submit btn login-btn" id="submitBtn" onclick="loginPwd();">
							<div class="text">还没有账号？去<a href="{:urls('reg/index')}">注册</a></div>
						</div>
					</form>
				</div>
				<div class="form">
					<form action="javascript:;">
						<div class="input_box phonelogin">
							<input type="text" name="mobphone" id="mobphone" placeholder="请输入手机号">
							<div class="icon">
								<img src="__STATIC__/qy_dd/web/img/sj.png?v=v11" alt="">
							</div>
						</div>
						<div class="input_box">
							<input type="text" name="phone_code" id="phone_code" placeholder="请输入手机验证码" class="code_input">
							<button class="code" type="button" onclick="get_code_num('mobphone')" id="phonecode getVcode2">获取验证码</button>
						</div>
						<div class="bot f-cb">
							<input type="submit" value="登录" class="submit btn login-btn" id="submitBtn1" onclick="check_num($('#phone_code'))">
							<div class="text">还没有账号？去<a href="{:urls('reg/index')}">注册</a></div>
						</div>
					</form>
				</div>
			</div>

		</div>
	</div>

	<!-- 扫码登录 start -->
	<div id="wx_login_content"  style="display: none;">
		<div class="login-mobile">
			<div class="default-state">
				<p class="qrcode-tit">微信扫码，安全登录</p>
				<div class="qrcode-box">
					<div class="qrcode"> <img src="{:purl('login/scan/qrcode',['type'=>'wx'])}" style="width:150px;height:150px"> </div>
				</div>
				<div class="qrcode-desc"> <i></i>
					<p> 打开微信
					<p>扫一扫登录</p>
					</p>
				</div>
				<div class="login-links"> <a href="javascript:void(0)" class="forget-pwd">密码登录</a> <a href="{:urls('reg/index')}" class="register" >免费注册</a> </div>
			</div>
		</div>
	</div>

</div>

</div>

</div>
{/block}
{block name="body_Footcont"}
<script>

	$(function(){
		$('.login_tit .choose a').click(function(){
			$(this).addClass('active').siblings().removeClass('active');
			var index=$(this).index();
			$('.fb .form').eq(index).addClass('show').siblings().removeClass('show');
		})

// 		var i=60;
// 		$('.code').click(function(){
// 			var _this=$(this);
// 			_this.text('重新发送'+i);
// 			var timer=setInterval(function(){
// 				if(i<=1){
// 					clearInterval(timer);
// 					_this.text('获取验证码');
// 					_this.attr('disabled',false);
// 					i=60;
// 					return;
// 				}
// 				i--;
// 				_this.text('重新发送'+i);
// 				_this.attr('disabled','disabled');
// 			},1000);
// 		})
	})

	function get_code_num(type) {
		var to = '';
		var obj = $(".phonelogin input[name='" + type + "']");
		to = obj.val();
		// alert(type)
		if (to == '') {
			obj.focus();
			layer.msg('请先输入手机号码');
			return false;
		}
		layer.msg('请稍候,系统正在发送手机验证码!', {
			time: 3000
		});
		$.get("{:urls('login/get_phone_num')}?phone=" + to + '&' + Math.random(), function(res) {
			layer.close();
			if (res.code == 0) {
				layer.alert('验证码已成功发出,请耐心等候,注意查收!');
			} else {
				layer.alert(res.msg);
			}
		});
	}

	function check_num(objs) {
		var vals = objs.val();
		var index = layer.load(1, {
			shade: [0.7, '#393D49']
		}, {
			shadeClose: true
		});
		$.get("{:urls('login/check_phone_num')}?num=" + vals + '&' + Math.random(), function(res) {
			layer.closeAll();
			if (res.code == 0) {
				if (res.data.type == 'login') {
					layer.msg('登录成功,欢迎' + res.data.username + '您回来');
					window.location.href = decodeURIComponent("{$fromurl}");
				} else if (res.data.type == 'reg') {
					$("#submit_btn").hide();
					layer.alert('验证成功,请为新帐号设置一个登录名');
					$("#phonename").show();
					$("#submit_reg").show();
				} else {
					layer.alert(res.msg);
				}
			} else {
				layer.msg(res.msg);
			}
		});
	}

	function checkinput(objs, type) {
		var vals = objs.val();
		$.get("{:urls('reg/check')}?" + type + "=" + vals + '&' + Math.random(), function(d) {
			if (d == 'ok') {
				objs.removeClass('error');
			} else {
				layer.msg(d);
				objs.addClass('error');
			}
		});
	}
	//二维码、PC登录切换
	$('.qrcode-target').click(function(){
		if($(this).hasClass('btn-qrcode')){
			$(this).removeClass('btn-qrcode').addClass('btn-login').attr('title','去电脑登录');

			$('.login-wrap').hide();
			$('.login-mobile').eq(0).removeClass("hide").show();

			return;
		}
		if($(this).hasClass('btn-login')){
			$(this).removeClass('btn-login').addClass('btn-qrcode').attr('title','去手机扫码登录');
			$('.login-wrap').show();
			$('.login-mobile').hide();
		}
	});
	$('.weixinsacn').click(function(){
		var index = layer.open({
			title: '微信扫码，安全登录',
			content: $('#wx_login_content').html()
		});
	});
	$('.forget-pwd').click(function(){
		$('.qrcode-target').removeClass('btn-login').addClass('btn-qrcode').attr('title','去手机扫码登录');
		$('.login-wrap').show();
		$('.login-mobile').hide();
	});
	function setTab(name, cursel, n) {
		for (i = 1; i <= n; i++) {
			var menu = $("#" + name + i);
			var con = $("#con_" + name + "_" + i);

			if (i == cursel) {
				$(con).show();
				$(menu).addClass("active");
			} else {
				$(con).hide();
				$(menu).removeClass("active");
			}
		}
	}
	function countSecond(){
		$.get("{:purl('login/scan/cklogin')}?"+Math.random(), function(data){
			if(data=='ok')window.location.href="{:purl('login/scan/cklogin')}?type=success";
		});
		setTimeout("countSecond()",2000);
	}
	countSecond()



	$(window).on("load resize",function(){
		var h=window.innerHeight||document.body.clientHeight||document.documentElement.clientHeight;
		$("body").css("height",h);
	});


</script>
{/block}